#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<unordered_map>
using namespace std;

void solve()
{
    int n; cin >> n;
    vector<int> arr(n + 5, 0);
    int temp; cin >> temp;
    arr[temp] = 1;
    int flag = 1;
    for (int i = 1; i < n; i++)
    {
        int num; cin >> num;
        if (!flag) continue;
        if (arr[num + 1] || arr[num - 1]) arr[num] = 1;
        else flag = 0;
    }
    if (flag) cout << "YES" << endl;
    else cout << "NO" << endl;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t; cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}